<template>
	<div class="about">
		<NavCom ref="mynav" :right_text="'分享'" bg_color="#f0f0f0"></NavCom>
		<p>outNum:{{outNum}}</p>
		<!-- $children 并不可取，子组件多了，就分不清是那个子组件了 -->
		<button @click="$children[0].myColor='#ff0000'">红</button>
		<button @click="$children[0].myColor='#00ff00'">绿</button>
		<button @click="$refs.mynav.myColor='blue'">蓝</button>
		<h2>{{a}}</h2>

	</div>
</template>
<script>
	// 导入utils request
	import request from '@/utils/request.js'
	import NavCom from '@/components/NavCom.vue'
	export default {
	// 数据的接收方（注入数据）
	inject: ["a"],
		components: {
			NavCom
		},
		data() {
			return {
				outNum: 5
			}
		},
		created() {
			// console.log(this.$children)
			// console.log(this.$parent,"parent")
			// console.log(this.$root,"root")
			request.get("http://abc.com/v5/list")
				.then(res => {
					console.log("模拟数据", res.data)
				})
				.catch(err => {
					console.log(err);
				})
		}
	}
</script>
